import {ProColumns} from "@ant-design/pro-table";
import {OptionActions} from "@/type/type";
import {Button, Space, Tag, Tooltip} from "antd";
import {change, dateFormat} from "@/utils/utils";

import {CopyOutlined} from "@ant-design/icons";

// @ts-ignore
export const columns: ProColumns[] = (optionAction: OptionActions<any, any>): ProColumns[] => {
  return [
    {
      title: "名称",
      render: (dom, entity, index, action, schema) =>{
        return "socializing"
      },
      align: "center",
      hideInSearch: true,
    },
    {
      title: "标签",
      render: (dom, entity, index, action, schema) =>{
        return <Tag color={"success"}>{entity.tags[0].name}</Tag>
      },
      align: "center",
      hideInSearch: true,
    },
    {
      title: "大小",
      dataIndex: "size",
      render: (dom, entity, index, action, schema) =>{
        return change(entity.size)
      },
      align: "center",
      hideInSearch: true,
    },
    {
      title: "推送时间",
      dataIndex: "push_time",
      hideInSearch: true,
      align: "center",
      render: (dom, entity, index, action, schema) =>{
        return dateFormat(entity.push_time)
      },
    },
    {
      title: '操作',
      valueType: 'option',
      align: 'center',
      render: (dom, entity, index, action, schema) => {
        return (
          <Space>
            <Tooltip title={`docker pull docker harbor.coolteasocial.com:6443/cool-tea/socializing:${entity.tags[0].name}`}>
            <Button type="link"  icon={<CopyOutlined />} onClick={() => {
            }}></Button>
            </Tooltip>
          </Space>
        )
      },
    },
  ]
}
